package com.lbj.googleplay.googleplay100.ui.holder;

import android.view.View;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.lbj.googleplay.googleplay100.R;
import com.lbj.googleplay.googleplay100.domain.AppInfo;
import com.lbj.googleplay.googleplay100.domain.SubjectInfo;
import com.lbj.googleplay.googleplay100.http.HttpHelper;
import com.lbj.googleplay.googleplay100.utils.UIUtils;

import org.xutils.ImageManager;
import org.xutils.image.ImageOptions;
import org.xutils.x;

public class SubjectHolder extends BaseHolder<SubjectInfo> {


    private ImageView iv_pic;
    private ImageManager imageManager;
    private TextView tv_title;


    @Override
    public View initView() {
        //1.加载布局
        View view = UIUtils.inflate(R.layout.list_item_subject);
        //2.初始化控件
         tv_title = view.findViewById(R.id.tv_title);
         iv_pic = view.findViewById(R.id.iv_pic);
         imageManager = x.image();
         return view;
    }

    @Override
    public void refreshView(SubjectInfo data) {
        ImageOptions.Builder builder = new ImageOptions.Builder();
        ImageOptions options = builder.build();
        imageManager.bind(iv_pic, HttpHelper.URL+"image?name="+data.url,options);
        tv_title.setText(data.des);
    }

}
